package com.cndw.kungfu.model;

import java.io.Serializable;

import com.cndw.kungfu.core.CacheDataBase;
import com.cndw.kungfu.core.CacheDataKey;
import com.cndw.kungfu.model.pvp.war.WarData;

/**
 * 华山论剑的数据保存入口
 * @author fantadust [9677889@qq.com]
 * @date 2012-7-12 下午2:55:41
 */
public class WarSerialize extends CacheDataBase implements Serializable {

	private static final long serialVersionUID = -20129677889L;

	private static WarSerialize instance = null;
	
	private WarData warData = new WarData();

	private WarSerialize(){
	}
	
	@Override
	public String getKey() {
		return CacheDataKey.keyWarSerialize;
	}

	public static WarSerialize getInstance() {
		if (instance == null) {
			synchronized (WarSerialize.class) {
				if (instance == null) {
					CacheDataBase cacheData = Context.getSysServer().initCacheData(CacheDataKey.keyWarSerialize);
					if (cacheData != null && cacheData instanceof WarSerialize) {
						instance = (WarSerialize) cacheData;
					}
					if (instance == null) {
						instance = new WarSerialize();
					}
					if (instance.getSyncDBTime() == 0) {
						instance.commitSync();
					}
				}
			}

		}
		return instance;

	}

	public WarData getWarData() {
		return warData;
	}
	
	

}
